#define _CRT_SECURE_NO_WARNINGS 1
#include "stack.h"

void testStack1()
{
	ST st;
	int ret = 0;
	InitStack(&st);
	STPush(&st, 1);
	ret = STtop(&st);
	printf("%d \n", ret);
	STPush(&st, 2);
	ret = STtop(&st);
	printf("%d \n", ret);
	STPop(&st);
	ret = STtop(&st);
	printf("%d \n", ret);

	/*STPush(&st, 2);
	ret = STtop(&st);
	printf("%d \n", ret);


	STPush(&st, 3);

	ret = STtop(&st);
	printf("%d \n", ret);

	STPush(&st, 4);

	ret = STtop(&st);
	printf("%d \n", ret);*/
	while (st.top--)
	{
		printf("%d ", st.a[st.top]);
	}
}

void testStack2()
{
	ST st;
	InitStack(&st);
	STPush(&st, 1);
	STPush(&st, 2);
	while (!STEmpty(&st))
	{
		printf("%d\n", STtop(&st));
		STPop(&st);
	}
	STPush(&st, 3);
	STPush(&st, 4);
	STPush(&st, 5);
	while (!STEmpty(&st))
	{
		printf("%d\n", STtop(&st));
		STPop(&st);
	}


}

int main()
{
	//testStack1();
	testStack2();
	return 0;
}